﻿using System;
using System.Collections;


namespace BizElements.BusinessLayer
{
    /// <summary>
    /// Collection of <see cref="ISearchEngineField"/> objects.
    /// </summary>
    public interface ISearchEngineFieldCollection : IEnumerable
    {
        #region Properties, indexers, methods.

        /// <summary>
        /// Searches the collection for the field with the specified <see cref="IBindableField.BindingName"/>.
        /// </summary>
        /// <param name="bindingName">Name of the bound property.</param>
        /// <returns>Specified field or <b>null</b> if a field with the given name is not found in the collection.</returns>
        ISearchEngineField this[string bindingName] { get; }

        /// <summary>
        /// Gets the element at the specified index.
        /// </summary>
        /// <param name="index">The zero-based index of the element to get or set. </param>
        /// <returns>The element at the specified index.</returns>
        ISearchEngineField this[int index] { get; }

        /// <summary>
        /// Gets the number of elements actually contained in the collection.
        /// </summary>
        int Count { get; }

        /// <summary>
        /// Resets all fields (including auto-populated and hidden fields) to their default state.
        /// </summary>
        void ResetAllFields();

        /// <summary>
        /// Resets all fields that match the specified criteria to their default state.
        /// </summary>
        /// <param name="resetAutoPopulatedFields">Indicates whether the fields whose <see cref="ISearchEngineField.IsAutoPopulated"/> property is set to <b>true</b> are to be reset.</param>
        /// <param name="resetHiddenFields">Indicates whether the fields whose <see cref="IBindableField.IsHidden"/> property is set to <b>true</b> are to be reset.</param>
        void ResetAllFields(bool resetAutoPopulatedFields, bool resetHiddenFields);

        /// <summary>
        /// Gets or sets optional filter name.
        /// </summary>
        string Name { get; set; }

        /// <summary>
        /// Gets or sets optional filter description.
        /// </summary>
        string Description { get; set; }

        #endregion
    }
}